class Student:
    def __init__(self):
        self.id = ''
        self.name = ''
        self.math_score = 0
        self.english_score = 0
        self.chinese_score = 0
        self.sum_score = 0

    def __str__(self):
        return f'{self.id} {self.name} {self.math_score} {self.english_score} {self.chinese_score} {self.sum_score}'

    def get_obj_str(self):
        return self.__str__()

    def sum(self):
        return self.math_score + self.english_score + self.chinese_score

    @staticmethod
    def init_from_input():
        student = Student()

        student.name = input('请输入姓名：')
        student.math_score = int(input('请输入数学成绩：'))
        student.english_score = int(input('请输入英语成绩：'))
        student.chinese_score = int(input('请输入语文成绩：'))
        student.sum_score = student.sum()

        return student


    @staticmethod
    def init_from_line(line):
        line = line.strip('\n')
        tokens = line.split(' ')

        student = Student()
        student.id = tokens[0]
        student.name = tokens[1]
        student.math_score = tokens[2]
        student.english_score = tokens[3]
        student.chinese_score = tokens[4]
        student.sum_score = int(student.math_score) + int(student.english_score) + int(student.chinese_score)

        return student
